package net.zhuike.novel.app.service;

import android.content.Context;

import net.zhuike.novel.app.bean.BookFonts;
import net.zhuike.novel.app.bean.HotWord;

import java.util.Map;

import framework.common.zanetwork.UeHttpUrl;
import framework.common.zanetwork.core.HttpCallback;
import framework.common.zanetwork.core.ResponseCallback;
import okhttp3.Response;

/**
 * Created by admin on 2017/7/20.
 */

public class UserService extends BaseService{
    public static  void getCode(final Context context, final ResponseCallback<Map> callback){
        httpHelper.get(UeHttpUrl.getCode()+"?t="+System.currentTimeMillis(), null, new HttpCallback<Map>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, Map o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static  void getFont(final Context context, final ResponseCallback<BookFonts> callback){
        httpHelper.get(UeHttpUrl.getFont(), null, new HttpCallback<BookFonts>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, BookFonts o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static  void getResigt(final Context context,final String parmas ,final ResponseCallback<Map> callback){
        httpHelper.get(UeHttpUrl.getResigt()+parmas, null, new HttpCallback<Map>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, Map o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static  void getLogin(final Context context,final String parmas ,final ResponseCallback<Map> callback){
        httpHelper.get(UeHttpUrl.getLogin()+parmas, null, new HttpCallback<Map>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, Map o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
}
